package com.example.liujie.stage

import com.badlogic.gdx.ApplicationAdapter
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.GL20
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.scenes.scene2d.Stage
import com.example.liujie.actor.MyActor

class StageGame : ApplicationAdapter() {

    lateinit var region: TextureRegion
    lateinit var myActor: MyActor
    lateinit var stage: Stage

    override fun create() {
        super.create()
        region = TextureRegion(Texture("a.jpg"))
        myActor = MyActor(region)
        stage = Stage()
        stage.addActor(myActor)
    }

    override fun render() {
        super.render()
        // 黑色清屏
        Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
        stage.act()
        stage.draw()
    }


    override fun dispose() {
        super.dispose()
        stage?.dispose()
    }
}